package be.ipl.finito.domaine;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import be.ipl.finito.util.Util;

@Entity
@Table(name="JETON", schema="FINITO")
public class Jeton implements Serializable{
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int id;
	
	@NotNull
	@Min(1)
	@Max(12)
	private int valeur;
	
	
	private int indice_tirage;
	
	protected Jeton(){
		
	}
	
	public Jeton(int valeur, int indice) {
		this.valeur = valeur;
		this.indice_tirage = indice;
	}

	public int getId() {
		return id;
	}

	public int getValeur() {
		return valeur;
	}

	public int getIndice_tirage() {
		return indice_tirage;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Jeton other = (Jeton) obj;
		if (id != other.id)
			return false;
		return true;
	}

}
